//
// @author 风杨
// @date 22-9-26 下午5:15
// @see <a href="yueny09@163.com">mailTo: yueny09@163.com</a>
//
pub mod mysql;
pub mod mysql_async;

#[cfg(test)]
mod test {
    use mysql::prelude::Queryable;
    use mysql::from_row;
    use crate::config::{get_jdbc_url, init_config};
    use crate::mysql_query::mysql::try_conn;

    #[test]
    pub fn test() {
        // init
        // 使用 log4rs::init_file 方法读取配置文件进行初始化
        log4rs::init_file("log4rs.yaml", Default::default()).unwrap();
        init_config();

        let url = get_jdbc_url();
        let mut conn = try_conn(&url);

        // let query_sql = String::from("select 1+1");
        let query_sql = String::from("select cluster_health_check()");
        conn.query_iter(&query_sql)
            .unwrap()
            .for_each(|row| {
                let r = row.unwrap();
                println!(
                    "Query Result: {:?}",
                    r
                );
            });
    }

}

